/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.aliyuncs.mts.transform.v20140618;

import java.util.ArrayList;
import java.util.List;

import com.aliyuncs.mts.model.v20140618.QueryCopyrightJobResponse;
import com.aliyuncs.mts.model.v20140618.QueryCopyrightJobResponse.DataItem;
import com.aliyuncs.transform.UnmarshallerContext;


public class QueryCopyrightJobResponseUnmarshaller {

	public static QueryCopyrightJobResponse unmarshall(QueryCopyrightJobResponse queryCopyrightJobResponse, UnmarshallerContext _ctx) {
		
		queryCopyrightJobResponse.setRequestId(_ctx.stringValue("QueryCopyrightJobResponse.RequestId"));
		queryCopyrightJobResponse.setMessage(_ctx.stringValue("QueryCopyrightJobResponse.Message"));
		queryCopyrightJobResponse.setStatusCode(_ctx.longValue("QueryCopyrightJobResponse.StatusCode"));

		List<DataItem> data = new ArrayList<DataItem>();
		for (int i = 0; i < _ctx.lengthValue("QueryCopyrightJobResponse.Data.Length"); i++) {
			DataItem dataItem = new DataItem();
			dataItem.setCallback(_ctx.stringValue("QueryCopyrightJobResponse.Data["+ i +"].Callback"));
			dataItem.setGmtCreate(_ctx.longValue("QueryCopyrightJobResponse.Data["+ i +"].GmtCreate"));
			dataItem.setGmtModified(_ctx.longValue("QueryCopyrightJobResponse.Data["+ i +"].GmtModified"));
			dataItem.setInput(_ctx.stringValue("QueryCopyrightJobResponse.Data["+ i +"].Input"));
			dataItem.setJobId(_ctx.stringValue("QueryCopyrightJobResponse.Data["+ i +"].JobId"));
			dataItem.setLevel(_ctx.longValue("QueryCopyrightJobResponse.Data["+ i +"].Level"));
			dataItem.setMessage(_ctx.stringValue("QueryCopyrightJobResponse.Data["+ i +"].Message"));
			dataItem.setMessageId(_ctx.longValue("QueryCopyrightJobResponse.Data["+ i +"].MessageId"));
			dataItem.setOutput(_ctx.stringValue("QueryCopyrightJobResponse.Data["+ i +"].Output"));
			dataItem.setStatus(_ctx.stringValue("QueryCopyrightJobResponse.Data["+ i +"].Status"));
			dataItem.setUserData(_ctx.stringValue("QueryCopyrightJobResponse.Data["+ i +"].UserData"));
			dataItem.setUserId(_ctx.longValue("QueryCopyrightJobResponse.Data["+ i +"].UserId"));
			dataItem.setResult(_ctx.stringValue("QueryCopyrightJobResponse.Data["+ i +"].Result"));

			data.add(dataItem);
		}
		queryCopyrightJobResponse.setData(data);
	 
	 	return queryCopyrightJobResponse;
	}
}